<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 마이페이지 컨트롤러
 */
class Mypage extends CI_Controller {
	
	var $data = array();
	
	function __construct() {
		parent::__construct();
		$this->data['category']['main'] = $this->uri->segment(1);
		$this->data['category']['sub']  = $this->uri->segment(2);
		$this->data['sess_userinfo'] = $this->session->userdata('userinfo');

		$this->load->model('mypage/Member_model', 'member', TRUE);
		$this->load->model('mypage/Pointhistory_model', 'point', TRUE);
		$this->load->model('mypage/Servicehistory_model', 'service', TRUE);
		$this->load->model('mypage/Paymenthistory_model', 'payment', TRUE);
	}

	// Default
	function index() {
		log_message('debug', "@@@@ Mypage::index()");
		
		$data['summary'] = $this->member->get_summary($this->data['sess_userinfo']['user_id']);
		// $this->data['package'] = $this->member->get_member_package($this->data['sess_userinfo']['user_id']);

		$this->data['INC_SUMMARY'] = $this->load->view('inc/summary_v', $data, TRUE);

		// 패키지, 쿠폰 리스트
		// $this->data['coupon_list'] = $this->member->select_member_package_coupon_list($this->data['package']['idx']);
		
		$this->data['service_history_list'] = $this->service->select_service_history_list($this->data['sess_userinfo']['user_id'],1,5);
		// $this->data['point_history_list'] = $this->point->select_point_history_list($this->data['sess_userinfo']['user_id'],1,5);
		// $this->data['payment_history_list'] = $this->payment->select_payment_history_list($this->data['sess_userinfo']['user_id'],1,5);

		// 내가 작성한 게시물
		$this->load->model('bbs/Bbs_model', 'bbs');
		$this->data['list'] = $this->bbs->select_bbs_list('', 'N', 'N', '', '', 1, 5, $this->data['sess_userinfo']['user_id']);
		
		$this->load->view('mypage/mypage_v', $this->data);
	}

}

/* End of file member.php */
/* Location: ./application/controllers/mypage/member.php */